package br.com.bafonline.controller.album;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import br.com.bafonline.helper.QuantidadeFigurinhaBean;
import br.com.bafonline.model.business.AlbumBO;
import br.com.bafonline.model.dto.UsuarioDTO;
import br.com.bafonline.util.struts.action.BaseAction;
import br.com.bafonline.util.struts.action.Tokens;

/**
 * Action (View) que lista todos os &aacute;lbuns de um determinado usu&aacute;rio.
 * @author bafonline
 *
 */
public class ListarAlbumUsuarioAction extends BaseAction {

	@SuppressWarnings("unchecked")
	@Override
	public ActionForward processExecute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {

		AlbumBO albumBO = new AlbumBO();
		UsuarioDTO usuarioDTO = (UsuarioDTO) request.getSession().getAttribute(Tokens.LOGIN);

		List<QuantidadeFigurinhaBean> list = albumBO.listarAlbumUsuario(usuarioDTO);
		request.setAttribute("list", list);
		request.setAttribute("listAlbuns", albumBO.listarAlbuns());

		return mapping.findForward(SUCCESS);
	}

}
